/** ****************************************************************************
 * Copyright (c) XXX

 * All rights reserved.
 *
 * @file    
 * @brief   
 * @version V1.0.0
 * @author  
 * @date    
 * @warning No Warnings
 * @note <b>history:</b>
 * 1. create file
 *
 */
#ifndef __HAL_CURRENT_H__
#define __HAL_CURRENT_H__

/*******************************************************************************
 * INCLUDES
 */
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C"{
#endif


typedef union 
{
    float  data_rx;
    uint8_t  a[4];
}data_t;


typedef struct {
    uint8_t header;                    /*!> command length MSB */
    uint8_t fix;                    /*!> command length LSB */
    uint8_t address;                    /*!> register address for register read/write commands */
    uint8_t cmd; /*!> raw data to be transfered */
} com_cmd_t;


typedef struct {
    uint8_t header;                    /*!> command length MSB */
    uint8_t fix;                    /*!> command length LSB */
    uint8_t address;                    /*!> register address for register read/write commands */
    data_t  data; /*!> raw data to be transfered */
    uint8_t verify;
} com_ans_t;



int hal_current_com_open(void **com_target_ptr, const char *com_path);

int hal_current_com_close(void *com_target);

int hal_current_read_single(int fd, float *data);

int hal_current_read_continuous(int fd, int cnt, float *data);

int hal_current_read_stop(int fd);




#ifdef __cplusplus
}
#endif

#endif

